<html>
<head>
<meta charset="utf-8" />
<link type="text/css" rel="stylesheet" href="style.css" />
<link href="http://alexgorbatchev.com/pub/sh/current/styles/shCore.css" rel="stylesheet" type="text/css" />
<link href="http://alexgorbatchev.com/pub/sh/current/styles/shThemeRDark.css" rel="stylesheet" type="text/css" />
<script src="http://alexgorbatchev.com/pub/sh/current/scripts/shCore.js" type="text/javascript"></script>
<script src="http://alexgorbatchev.com/pub/sh/current/scripts/shAutoloader.js" type="text/javascript"></script>
<script src="http://alexgorbatchev.com/pub/sh/current/scripts/shBrushPhp.js" type="text/javascript"></script>
<script type="text/javascript">
SyntaxHighlighter.all();
</script>
</head>
<body>
<div class="header" style="border-top: 1px solid #C9D7F1;margin: 9px;margin-top: 24px;padding-top: 5px;margin-bottom: 10px;">
    <a href="http://code.google.com/p/yuki/"><img src="http://code.google.com/p/yuki/logo?cct=1297980533" /></a>
    <div style="display: inline-block;padding-left: 11px;">
        <div class="project-name">
            <a style="text-decoration: none;color: #666;font-family: arial, sans-serif;font-size: 39px;" href="http://code.google.com/p/yuki/">yuki</a>
        </div>
        <div class="project-summary">
            <a href="http://code.google.com/p/yuki/" style="text-decoration: none;color: #444;font-family: arial, sans-serif;font-size: 13px;">Yuki PHP Framework</a>
        </div>
    </div>
</div>
<table width="100%"><tr><td width="200" valign="top">
<div class="sidebar"><ul><li class="package">yuki<ul><li class="subpackage">autoload<ul><li class="class"><a href="yAutoloader.html">yAutoloader</a></li><li class="class"><a href="yCoreAutoloader.html">yCoreAutoloader</a></li></ul></li><li class="subpackage">output<ul><li class="class"><a href="yBuffer.html">yBuffer</a></li></ul></li><li class="subpackage">callable<ul><li class="class"><a href="yCallable.html">yCallable</a></li></ul></li><li class="subpackage">debug<ul><li class="class"><a href="yDebugger.html">yDebugger</a></li></ul></li><li class="subpackage">geometry<ul><li class="class"><a href="yDimension.html">yDimension</a></li><li class="class"><a href="yPoint.html">yPoint</a></li><li class="class"><a href="yRectangle.html">yRectangle</a></li></ul></li><li class="subpackage">doc<ul><li class="class"><a href="yDocBlock.html">yDocBlock</a></li><li class="class"><a href="yDocumentor.html">yDocumentor</a></li><li class="class"><a href="yMethodDocumentor.html">yMethodDocumentor</a></li></ul></li><li class="subpackage">exception<ul><li class="class"><a href="yException.html">yException</a></li><li class="class"><a href="yExceptionHandler.html">yExceptionHandler</a></li></ul></li><li class="subpackage">file<ul><li class="class"><a href="yFile.html">yFile</a></li></ul></li><li class="subpackage">log<ul><li class="class"><a href="yLogMessage.html">yLogMessage</a></li><li class="class"><a href="yLogRoute.html">yLogRoute</a></li><li class="class"><a href="yLogger.html">yLogger</a></li><li class="class"><a href="yStderrLogRoute.html">yStderrLogRoute</a></li><li class="class"><a href="yStdoutLogRoute.html">yStdoutLogRoute</a></li><li class="class"><a href="yStreamLogRoute.html">yStreamLogRoute</a></li></ul></li><li class="subpackage">profiler<ul><li class="class"><a href="yProfiler.html">yProfiler</a></li></ul></li><li class="subpackage">uri<ul><li class="class"><a href="yUri.html">yUri</a></li><li class="class"><a href="yUriAuthority.html">yUriAuthority</a></li><li class="class"><a href="yUriFragment.html">yUriFragment</a></li><li class="class"><a href="yUriPath.html">yUriPath</a></li><li class="class"><a href="yUriQuery.html">yUriQuery</a></li><li class="class"><a href="yUriScheme.html">yUriScheme</a></li></ul></li></ul></li></ul></div>            
</td><td valign="top">
            
<h1>yUriQuery</h1>
<div><b>@package</b> yuki</div>
<div><b>@subpackage</b> uri</div>

<!-- Hierarhy -->

<h2>Introduction</h2>
yUriQuery implements query part of URI<br />
<br />



<h2>Method Summary</h2>
<div class="summary" style="padding-bottom: 5px;margin-bottom: 5px;border-bottom: 1px solid #AAA;"><div class="method">string <a href="#method.get">get</a>(<span class="param">$name, $default = </span>);</div><div style="font-size: 11px; margin-top: 1em;">Retrieves a query parameter.</div></div><div class="summary" style="padding-bottom: 5px;margin-bottom: 5px;border-bottom: 1px solid #AAA;"><div class="method">yUriQuery <a href="#method.set">set</a>(<span class="param">$name, $value = ""</span>);</div><div style="font-size: 11px; margin-top: 1em;">Sets a query parameter.</div></div><div class="summary" style="padding-bottom: 5px;margin-bottom: 5px;border-bottom: 1px solid #AAA;"><div class="method">yUriQuery <a href="#method.clear">clear</a>(<span class="param"></span>);</div><div style="font-size: 11px; margin-top: 1em;">Clears all current query parameters.</div></div><div class="summary" style="padding-bottom: 5px;margin-bottom: 5px;border-bottom: 1px solid #AAA;"><div class="method"><a href="#method.__get">__get</a>(<span class="param">$name</span>);</div><div style="font-size: 11px; margin-top: 1em;"></div></div><div class="summary" style="padding-bottom: 5px;margin-bottom: 5px;border-bottom: 1px solid #AAA;"><div class="method"><a href="#method.__set">__set</a>(<span class="param">$name, $value</span>);</div><div style="font-size: 11px; margin-top: 1em;"></div></div><div class="summary" style="padding-bottom: 5px;margin-bottom: 5px;border-bottom: 1px solid #AAA;"><div class="method"><a href="#method.__isset">__isset</a>(<span class="param">$name</span>);</div><div style="font-size: 11px; margin-top: 1em;"></div></div><div class="summary" style="padding-bottom: 5px;margin-bottom: 5px;border-bottom: 1px solid #AAA;"><div class="method"><a href="#method.__unset">__unset</a>(<span class="param">$name</span>);</div><div style="font-size: 11px; margin-top: 1em;"></div></div><div class="summary" style="padding-bottom: 5px;margin-bottom: 5px;border-bottom: 1px solid #AAA;"><div class="method"><a href="#method.offsetGet">offsetGet</a>(<span class="param">$offset</span>);</div><div style="font-size: 11px; margin-top: 1em;"></div></div><div class="summary" style="padding-bottom: 5px;margin-bottom: 5px;border-bottom: 1px solid #AAA;"><div class="method"><a href="#method.offsetSet">offsetSet</a>(<span class="param">$offset, $value</span>);</div><div style="font-size: 11px; margin-top: 1em;"></div></div><div class="summary" style="padding-bottom: 5px;margin-bottom: 5px;border-bottom: 1px solid #AAA;"><div class="method"><a href="#method.offsetExists">offsetExists</a>(<span class="param">$offset</span>);</div><div style="font-size: 11px; margin-top: 1em;"></div></div><div class="summary" style="padding-bottom: 5px;margin-bottom: 5px;border-bottom: 1px solid #AAA;"><div class="method"><a href="#method.offsetUnset">offsetUnset</a>(<span class="param">$offset</span>);</div><div style="font-size: 11px; margin-top: 1em;"></div></div><div class="summary" style="padding-bottom: 5px;margin-bottom: 5px;border-bottom: 1px solid #AAA;"><div class="method"><a href="#method.loadString">loadString</a>(<span class="param">$queryString</span>);</div><div style="font-size: 11px; margin-top: 1em;"></div></div><div class="summary" style="padding-bottom: 5px;margin-bottom: 5px;border-bottom: 1px solid #AAA;"><div class="method">static <a href="#method.fromString">fromString</a>(<span class="param">$queryString</span>);</div><div style="font-size: 11px; margin-top: 1em;"></div></div><div class="summary" style="padding-bottom: 5px;margin-bottom: 5px;border-bottom: 1px solid #AAA;"><div class="method"><a href="#method.__toString">__toString</a>(<span class="param"></span>);</div><div style="font-size: 11px; margin-top: 1em;"></div></div>
<h2>Method Details</h2>
<div style="padding: 4px;border: solid 1px #666;"><a name="method.get"></a><div style="font-size: 11px;"><div class="classsynopsis"><div class="method">string <a href="#method.get">get</a>(<span class="param">$name, $default = </span>);</div></div><div style="padding: 7px; margin-bottom: 2em; border: dashed 1px #eee; margin-tOP; 1em;"><div><b style="color: #683B00;">$name</b> (string) </div><div><b style="color: #683B00;">$default</b> (mixed) </div><div style="margin-top: 1em; margin-bottom: 1em;"><div><h3>Retrieves a query parameter.</h3></div></div><div><b>returns</b> string </div></div></div><h3>Source Code</h3><pre class="brush: php">    public function get($name, $default = null){
        return $this-&gt;__isset($name)?$this-&gt;_query[$name]:$default;
    }
</pre></div><div style="padding: 4px;border: solid 1px #666;"><a name="method.set"></a><div style="font-size: 11px;"><div class="classsynopsis"><div class="method">yUriQuery <a href="#method.set">set</a>(<span class="param">$name, $value = ""</span>);</div></div><div style="padding: 7px; margin-bottom: 2em; border: dashed 1px #eee; margin-tOP; 1em;"><div><b style="color: #683B00;">$name</b> (string) </div><div><b style="color: #683B00;">$value</b> (string) </div><div style="margin-top: 1em; margin-bottom: 1em;"><div><h3>Sets a query parameter.</h3></div></div><div><b>returns</b> yUriQuery </div></div></div><h3>Source Code</h3><pre class="brush: php">    public function set($name, $value = ''){
        $this-&gt;_query[$name] = $value;
        return $this;
    }
</pre></div><div style="padding: 4px;border: solid 1px #666;"><a name="method.clear"></a><div style="font-size: 11px;"><div class="classsynopsis"><div class="method">yUriQuery <a href="#method.clear">clear</a>(<span class="param"></span>);</div></div><div style="padding: 7px; margin-bottom: 2em; border: dashed 1px #eee; margin-tOP; 1em;"><div style="margin-top: 1em; margin-bottom: 1em;"><div><h3>Clears all current query parameters.</h3></div></div><div><b>returns</b> yUriQuery </div></div></div><h3>Source Code</h3><pre class="brush: php">    public function clear(){
        $this-&gt;_query = array();
        return $this;
    }
</pre></div><div style="padding: 4px;border: solid 1px #666;"><a name="method.__get"></a><div style="font-size: 11px;"><div class="classsynopsis"><div class="method"><a href="#method.__get">__get</a>(<span class="param">$name</span>);</div></div><div style="padding: 7px; margin-bottom: 2em; border: dashed 1px #eee; margin-tOP; 1em;"><div style="margin-top: 1em; margin-bottom: 1em;"><div><h3></h3></div></div></div></div><h3>Source Code</h3><pre class="brush: php">    public function __get($name){
        return $this-&gt;get($name);
    }
</pre></div><div style="padding: 4px;border: solid 1px #666;"><a name="method.__set"></a><div style="font-size: 11px;"><div class="classsynopsis"><div class="method"><a href="#method.__set">__set</a>(<span class="param">$name, $value</span>);</div></div><div style="padding: 7px; margin-bottom: 2em; border: dashed 1px #eee; margin-tOP; 1em;"><div style="margin-top: 1em; margin-bottom: 1em;"><div><h3></h3></div></div></div></div><h3>Source Code</h3><pre class="brush: php">    public function __set($name, $value){
        $this-&gt;set($name, $value);
    }
</pre></div><div style="padding: 4px;border: solid 1px #666;"><a name="method.__isset"></a><div style="font-size: 11px;"><div class="classsynopsis"><div class="method"><a href="#method.__isset">__isset</a>(<span class="param">$name</span>);</div></div><div style="padding: 7px; margin-bottom: 2em; border: dashed 1px #eee; margin-tOP; 1em;"><div style="margin-top: 1em; margin-bottom: 1em;"><div><h3></h3></div></div></div></div><h3>Source Code</h3><pre class="brush: php">    public function __isset($name){
        return array_key_exists($name, $this-&gt;_query);
    }
</pre></div><div style="padding: 4px;border: solid 1px #666;"><a name="method.__unset"></a><div style="font-size: 11px;"><div class="classsynopsis"><div class="method"><a href="#method.__unset">__unset</a>(<span class="param">$name</span>);</div></div><div style="padding: 7px; margin-bottom: 2em; border: dashed 1px #eee; margin-tOP; 1em;"><div style="margin-top: 1em; margin-bottom: 1em;"><div><h3></h3></div></div></div></div><h3>Source Code</h3><pre class="brush: php">    public function __unset($name){
        unset($this-&gt;_query[$name]);
    }
</pre></div><div style="padding: 4px;border: solid 1px #666;"><a name="method.offsetGet"></a><div style="font-size: 11px;"><div class="classsynopsis"><div class="method"><a href="#method.offsetGet">offsetGet</a>(<span class="param">$offset</span>);</div></div><div style="padding: 7px; margin-bottom: 2em; border: dashed 1px #eee; margin-tOP; 1em;"><div style="margin-top: 1em; margin-bottom: 1em;"><div><h3></h3></div></div></div></div><h3>Source Code</h3><pre class="brush: php">    public function offsetGet($offset){
        return $this-&gt;get($offset);
    }
</pre></div><div style="padding: 4px;border: solid 1px #666;"><a name="method.offsetSet"></a><div style="font-size: 11px;"><div class="classsynopsis"><div class="method"><a href="#method.offsetSet">offsetSet</a>(<span class="param">$offset, $value</span>);</div></div><div style="padding: 7px; margin-bottom: 2em; border: dashed 1px #eee; margin-tOP; 1em;"><div style="margin-top: 1em; margin-bottom: 1em;"><div><h3></h3></div></div></div></div><h3>Source Code</h3><pre class="brush: php">    public function offsetSet($offset, $value){
        $this-&gt;set($offset, $value);
    }
</pre></div><div style="padding: 4px;border: solid 1px #666;"><a name="method.offsetExists"></a><div style="font-size: 11px;"><div class="classsynopsis"><div class="method"><a href="#method.offsetExists">offsetExists</a>(<span class="param">$offset</span>);</div></div><div style="padding: 7px; margin-bottom: 2em; border: dashed 1px #eee; margin-tOP; 1em;"><div style="margin-top: 1em; margin-bottom: 1em;"><div><h3></h3></div></div></div></div><h3>Source Code</h3><pre class="brush: php">    public function offsetExists($offset){
        return $this-&gt;__isset($offset);
    }
</pre></div><div style="padding: 4px;border: solid 1px #666;"><a name="method.offsetUnset"></a><div style="font-size: 11px;"><div class="classsynopsis"><div class="method"><a href="#method.offsetUnset">offsetUnset</a>(<span class="param">$offset</span>);</div></div><div style="padding: 7px; margin-bottom: 2em; border: dashed 1px #eee; margin-tOP; 1em;"><div style="margin-top: 1em; margin-bottom: 1em;"><div><h3></h3></div></div></div></div><h3>Source Code</h3><pre class="brush: php">    public function offsetUnset($offset){
        $this-&gt;__unset($offset);
    }
</pre></div><div style="padding: 4px;border: solid 1px #666;"><a name="method.loadString"></a><div style="font-size: 11px;"><div class="classsynopsis"><div class="method"><a href="#method.loadString">loadString</a>(<span class="param">$queryString</span>);</div></div><div style="padding: 7px; margin-bottom: 2em; border: dashed 1px #eee; margin-tOP; 1em;"><div style="margin-top: 1em; margin-bottom: 1em;"><div><h3></h3></div></div></div></div><h3>Source Code</h3><pre class="brush: php">    public function loadString($queryString){
        $this-&gt;clear();
        $args = explode('&amp;', $queryString);
        foreach ($args as $arg){
            $p = strpos($arg, '=');
            if ($p === false){
                $this-&gt;set($arg);
            }else{
                $this-&gt;set(
                        substr($arg, 0, $p),
                        substr($arg, $p + 1)
                );
            }
        }
        return $this;
    }
</pre></div><div style="padding: 4px;border: solid 1px #666;"><a name="method.fromString"></a><div style="font-size: 11px;"><div class="classsynopsis"><div class="method">static <a href="#method.fromString">fromString</a>(<span class="param">$queryString</span>);</div></div><div style="padding: 7px; margin-bottom: 2em; border: dashed 1px #eee; margin-tOP; 1em;"><div style="margin-top: 1em; margin-bottom: 1em;"><div><h3></h3></div></div></div></div><h3>Source Code</h3><pre class="brush: php">    public static function fromString($queryString){
        $query = new yUriQuery();
        $query-&gt;loadString($queryString);
        return $query;
    }
</pre></div><div style="padding: 4px;border: solid 1px #666;"><a name="method.__toString"></a><div style="font-size: 11px;"><div class="classsynopsis"><div class="method"><a href="#method.__toString">__toString</a>(<span class="param"></span>);</div></div><div style="padding: 7px; margin-bottom: 2em; border: dashed 1px #eee; margin-tOP; 1em;"><div style="margin-top: 1em; margin-bottom: 1em;"><div><h3></h3></div></div></div></div><h3>Source Code</h3><pre class="brush: php">    public function __toString(){
        $args = array();
        foreach ($this-&gt;_query as $name=&gt;$value){
            if ($value === ''){
                $args[] = $name;
            }else{
                $args[] = $name.'='.$value;
            }
        }
        $queryString = implode('&amp;', $args);
        return (string) (strlen($queryString)?'?':'').$queryString;
    }
</pre></div>


<h2>Class synopsis</h2>
<div class="classsynopsis">
<b class="classname">yUriQuery</b> implements ArrayAccess {
<div class="contents">
<h3>/* Properties */</h3>
<div class="property">private <a href="#property._query">$_query</a>;</div>
<h3>/* Methods */</h3>
<div class="method">string <a href="#method.get">get</a>(<span class="param">$name, $default = </span>);</div><div class="method">yUriQuery <a href="#method.set">set</a>(<span class="param">$name, $value = ""</span>);</div><div class="method">yUriQuery <a href="#method.clear">clear</a>(<span class="param"></span>);</div><div class="method"><a href="#method.__get">__get</a>(<span class="param">$name</span>);</div><div class="method"><a href="#method.__set">__set</a>(<span class="param">$name, $value</span>);</div><div class="method"><a href="#method.__isset">__isset</a>(<span class="param">$name</span>);</div><div class="method"><a href="#method.__unset">__unset</a>(<span class="param">$name</span>);</div><div class="method"><a href="#method.offsetGet">offsetGet</a>(<span class="param">$offset</span>);</div><div class="method"><a href="#method.offsetSet">offsetSet</a>(<span class="param">$offset, $value</span>);</div><div class="method"><a href="#method.offsetExists">offsetExists</a>(<span class="param">$offset</span>);</div><div class="method"><a href="#method.offsetUnset">offsetUnset</a>(<span class="param">$offset</span>);</div><div class="method"><a href="#method.loadString">loadString</a>(<span class="param">$queryString</span>);</div><div class="method">static <a href="#method.fromString">fromString</a>(<span class="param">$queryString</span>);</div><div class="method"><a href="#method.__toString">__toString</a>(<span class="param"></span>);</div>
</div>
}
</div>


</td></tr></table>
</body>
</html>